<script setup lang="ts">
import { useRouter } from 'vue-router';



defineProps<{
  title?: string
  rightText?: string
}>()

const emit = defineEmits<{
  (e: 'click-right') : void
}>()

const router = useRouter()
const onClickLetf = () => {
  if(history.state?.back){
    router.back()
  } else {
    router.push('/')
  }
}

const onClickRight = () => {
  emit('click-right')
}

</script>

<template>
  <van-nav-bar
  fixed
  left-arrow
  @click-left="onClickLetf"
  :title="title"
  :right-text="rightText"
  @click-right="onClickRight"
  ></van-nav-bar>
</template>



<style>

</style>
